package sto.orz.html;

import java.lang.reflect.Field;


public class AttributeBuilder {
	public static Attribute getFormAttribute(Field field) throws AnnotationNotFoundException {
		Attribute attr;
		try {
			Element ele = field.getAnnotation(Element.class);
			attr = getFormAttribute(ele);
		} catch (NullPointerException e) {
			throw new AnnotationNotFoundException(e);
		}
		return attr;
	}

	public static Attribute getFormAttribute(Element ele) {
		Attribute attr = new Attribute();
		attr.setLabel(ele.label());
		attr.setExtendMode(ele.extendMode());
		attr.setElementType(ele.elementType());
		return attr;
	}
}
